<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box1{
      width: 500px;
      height: 500px;
      background: #d34545;
    }
    #box2{
      width: 300px;
      height: 300px;
      background: #3dda38;
    }
    li{
      font-size: 30px;
    }
  </style>
</head>
<body>
  <!-- <div id="box1">
    <div id="box2"></div>
  </div>

  <script>
    let box1 = document.getElementById('box1');
    let box2 = document.getElementById('box2');

    box1.addEventListener('click', () => {
      console.log('box1');
    })
    box2.addEventListener('click', () => {
      console.log('box2');
    })
  </script> -->

  <ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
  </ul>

  <script>
    // let lis = document.querySelectorAll('li')
    // lis.forEach(function(li) {
    //   li.addEventListener('click', function() {
    //     console.log(this.innerHTML);
    //   })
    // })

    let ul = document.querySelector('ul')
    ul.addEventListener('click', function(e) {
      console.log(e.target.innerHTML);
    })
  </script>
</body>
</html>